/**
 * 鸡蛋白JS
 */
    /* 鼠标移动至相应选择器上执行图片缩小功能 */
    $("#look_video_btn,#video_img").mouseenter(function(){
      $("#video_img").animate({width:'1439px',height:"382px",marginLeft:"102.5px"},2600);
    });
    /* 点击播放视频 */
    function look_glair_cd(){
      $('.video .video_top,.video .beta,.video .look_video_btn,.video .free_receive,.video .video_img').css({'display': 'none'});
      $('#glair_cd').css({'display': 'block'});
    }
    /* 点击关闭按钮关闭投票领奖弹窗 */
    $('.ballot_popup .close').click(function(){
      $('.full_screen,.ballot_popup').hide();
    });
    function comment(){
      var url = "glair.php?act=comment";
      var comment = $("#comment_content").val();
      if(comment ==""||comment == null){
        Ctf("评论不能为空");
        return false;
      }
      $.post(url,{comment :comment},function(result){
        comment_return(result);
      },'json');
    }

    function comment_return(result){
      if(result.error == 1){
        window.location.reload(); 
      }
      if(result.error == 2){
        Ctf(result.content); 
      }
    }

    function agree(obj,num){
      var url = "glair.php?act=agree";
      $.post(url,{comment_id :num},function(result){
        agree_return(result);
      },'json');
    }

    function agree_return(result){
      if(result.error == 2){
      Ctf(result.content);
      return false;
      }
      var agree_num = parseInt($(obj).find('.agree_num').html());
      $(obj).find('.agree_num').html(agree_num+1);
    }

    function more_comment(){
      var url = "glair.php?act=more_comment";
      var pages = $("#pages").val();
      $.post(url,{pages :pages},function(result){
        more_comment_return(result);
      },'json');
    }

    function more_comment_return(result){
      if(result.error == 1){
        $('.more_commemt').before(result.content);
        var pages = parseInt($("#pages").val());
        $("#pages").val(pages+1);
      }
      if(result.error == 2){
        Ctf(result.content);
      }
    }

    /* 调用轮播插件 */
    $(window).load(function() {
      $('.flexslider').flexslider({
        animation: "slide",
        controlNav: true,
        animationLoop: true,
        slideshow: true,
        slideshowSpeed: 3000,
      });
    });

    /* 鸡蛋白的研发改进鼠标移动效果 */
    $(function(){
        $('.research .list1').mouseenter(function(){
            $('.research .bottom .item').animate({"marginLeft":"86.5px"},15).text("8月17日");
        });
        $('.research .list2').mouseenter(function(){
            $('.research .bottom .item').animate({"marginLeft":"370px"},15).text("8月18日");
        });
        $('.research .list3').mouseenter(function(){
            $('.research .bottom .item').animate({"marginLeft":"655px"},15).text("8月19日");
        });
        $('.research .list4').mouseenter(function(){
            $('.research .bottom .item').animate({"marginLeft":"940px"},15).text("8月20日");
        });
    });

    // 百度分享
    window._bd_share_config = {
        common : {
            bdText : "bdText",
            bdDesc : "bdDesc",
            bdUrl : "bdUrl",
            bdPic : "bdPic"
        },
        share : [{
            "bdSize" : 16
        }],
    }
    with(document)[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];

    // 点击显示领取反馈
    function showPanic(){
        $.getJSON('glair.php?act=get_glair',function(result){
            if (result.error == 8000) {
                ajax_popup('login');
            } else if (result.error == 8012) {
                $('.panic-popup, .mask, .panic-popup .no-time').show();
            } else if (result.error == 8003) {
                $('.panic-popup, .mask, .panic-popup .failure').show();
            } else if (result.error == 8013) {
                $('.panic-popup, .mask, .panic-popup .no-time2').show();
            } else if (result.error == 0 || result.error == 8001) {
                $('.panic-popup, .mask, .panic-popup .success').show();
            }
        });
    }

    // 点击关闭弹窗和弹窗背景
    $('.panic-popup .close').click(function(){
        $('.panic-popup,.mask').hide();
    });

    // 点击分享改变内容
    $('.bdsharebuttonbox a').click(function(){
        $.getJSON('glair.php?act=get_glairBaoyou',function(result){
            if (result.error == 0) {
                $('.panic-popup .success').hide();
                $('.panic-popup .share-back').show();
            } else {
                $('.panic-popup .success').hide();
                $('.panic-popup .share-back2').show();
            }
        });
    });
